
import threading
import socket

class Device(threading.Thread):
    def __init__(self, conn, ip):
        threading.Thread.__init__(self)
        self.lng = 0.0      # 经度
        self.lat = 0.0      # 纬度
        self.imei = "0000"      # 编号
        self.link_status = False
        self.conn = conn
        self.ip = ip
        self.thread_flag = True

    def run(self):
        while self.thread_flag:
            data = self.conn.recv(1024)
            print('recv: ', data.decode())
            self.conn.send(data.upper())
        conn.close()
